
#ifndef	__COMMON_TYPE_H__
#define	__COMMON_TYPE_H__


#ifndef NULL
#ifdef __cplusplus
#define NULL    0
#else
#define NULL    ((void *)0)
#endif
#endif

#ifndef FALSE
#define FALSE               0
#endif

#ifndef TRUE
#define TRUE                1
#endif

#ifndef CONST
#define CONST               const
#endif

#define far
#define near


typedef int                 INT_PTR, *PINT_PTR;
typedef unsigned int        UINT_PTR, *PUINT_PTR;
typedef long                LONG_PTR, *PLONG_PTR;
typedef unsigned long       ULONG_PTR, *PULONG_PTR;
typedef ULONG_PTR           DWORD_PTR, *PDWORD_PTR;

//typedef int                 BOOL;
typedef unsigned char       BOOL;
typedef unsigned char       BYTE;
typedef unsigned short      WORD;
typedef long                LONG;
typedef unsigned long       DWORD;
typedef float               FLOAT;
typedef FLOAT               *PFLOAT;
typedef BOOL near           *PBOOL;
typedef BOOL far            *LPBOOL;
typedef BYTE near           *PBYTE;
typedef BYTE far            *LPBYTE;
typedef int near            *PINT;
typedef int far             *LPINT;
typedef WORD near           *PWORD;
typedef WORD far            *LPWORD;
typedef long far            *LPLONG;
typedef DWORD near          *PDWORD;
typedef DWORD far           *LPDWORD;
typedef void far            *LPVOID;
typedef CONST void far      *LPCVOID;

typedef int                 INT;
typedef unsigned int        UINT;
typedef unsigned int        *PUINT;

typedef UINT_PTR            WPARAM;
typedef LONG_PTR            LPARAM;
typedef LONG_PTR            LRESULT;


#ifndef max
#define max(a,b)            (((a) > (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b)            (((a) < (b)) ? (a) : (b))
#endif

#ifndef	_countof
#define _countof(a)			(sizeof(a) / sizeof(a[0]))
#endif

#ifndef	MAKEWORD
#define MAKEWORD(l, h)      ((WORD)(((BYTE)(((DWORD_PTR)(l)) & 0xff)) | ((WORD)((BYTE)(((DWORD_PTR)(h)) & 0xff))) << 8))
#endif

#ifndef	MAKELONG
#define MAKELONG(l, h)      ((LONG)(((WORD)(((DWORD_PTR)(l)) & 0xffff)) | ((DWORD)((WORD)(((DWORD_PTR)(h)) & 0xffff))) << 16))
#endif

#ifndef	LOWORD
#define LOWORD(l)           ((WORD)(((DWORD_PTR)(l)) & 0xffff))
#endif

#ifndef	HIWORD
#define HIWORD(l)           ((WORD)((((DWORD_PTR)(l)) >> 16) & 0xffff))
#endif

#if	1
#ifndef	LOBYTE
#define LOBYTE(w)           ((BYTE)(((DWORD_PTR)(w)) & 0xff))
#endif
#ifndef	HIBYTE
#define HIBYTE(w)           ((BYTE)((((DWORD_PTR)(w)) >> 8) & 0xff))
#endif
#endif

#endif	//__COMMON_TYPE_H__
